<?php /* Smarty version Smarty-3.1.14, created on 2017-08-23 10:04:08
         compiled from "E:\phpStudy\WWW\zyshop\admin\templates\brand_list.html" */ ?>
<?php /*%%SmartyHeaderCode:10362599512367cdc54-55117942%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'ba0635f7a099409f2a98c12e58590f11f816265b' => 
    array (
      0 => 'E:\\phpStudy\\WWW\\zyshop\\admin\\templates\\brand_list.html',
      1 => 1503453847,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '10362599512367cdc54-55117942',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.14',
  'unifunc' => 'content_599512368058a4_67865434',
  'variables' => 
  array (
    'brand_list' => 0,
    'list' => 0,
    'page' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_599512368058a4_67865434')) {function content_599512368058a4_67865434($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<style>
th{ text-align:left;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>品牌</h3>
    <div style="background:rgba(251,112,45,1);width:125px;height:40px;float:right;text-align:center;border-radius:5px;">
      <a href="brand.php?act=edit">
        <h5 style="padding:10px;color:#fff;">添加品牌</h5>
      </a>
    </div>
  </div>
</div>
<div class="fixed_bottom">
    <table align="center;" class="table tb-type2">
      <thead>
        <tr>
          <th width="10"></th>
          <th width="50"><a>编号</a></th>
          <th width="25%"><a>品牌名称</a></th>
          <th><a>图片标识</a></th> 
          <th><a>品牌网址</a></th>
          <th><a>描述</a></th>
          <th><a>排序</a></th>
          <th><a>显示</a></th>
          <th width="10%"><a>操作</a></th>
        </tr>
      </thead>
      <tbody>
      	<?php  $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['list']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['brand_list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value){
$_smarty_tpl->tpl_vars['list']->_loop = true;
?>
      	<tr id="<?php echo $_smarty_tpl->tpl_vars['list']->value['brand_id'];?>
">
          <td></td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['brand_id'];?>
</td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['brand_name'];?>
</td>
          <td><img height="50" src="../<?php echo $_smarty_tpl->tpl_vars['list']->value['brand_logo'];?>
" /></td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['site_url'];?>
</td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['brand_desc'];?>
</td>
          <td><input style="width:30px;" onChange="sort(this,<?php echo $_smarty_tpl->tpl_vars['list']->value['brand_id'];?>
)" name="sort_order" type="text" value="<?php echo $_smarty_tpl->tpl_vars['list']->value['sort_order'];?>
" /></td>
          <td><i style="cursor:pointer;" onclick="ajax_sale(this,<?php echo $_smarty_tpl->tpl_vars['list']->value['brand_id'];?>
,<?php echo $_smarty_tpl->tpl_vars['list']->value['is_show'];?>
)" name="is_show" class="fa <?php if ($_smarty_tpl->tpl_vars['list']->value['is_show']==1){?>fa-check<?php }else{ ?>fa-close<?php }?>"></i></td>
          <td>
            <a href="brand.php?act=edit&b_id=<?php echo $_smarty_tpl->tpl_vars['list']->value['brand_id'];?>
">编辑</a> | 
            <span style="cursor:pointer;" onclick="ajax_del(this,<?php echo $_smarty_tpl->tpl_vars['list']->value['brand_id'];?>
)">删除</span>
          </td>
        </tr>
        <?php } ?>
      </tbody>
    </table>
    <div class="page"><?php echo $_smarty_tpl->tpl_vars['page']->value;?>
</div>
</div>
</body>
<script>
//ajax改变是否状态
function ajax_sale(obj,id,price){
  if(price==1){
    prices="1";
  }else{
    prices="2";
  }
  $.post("brand.php",{act:'ajax_sale',brand_id:id,zt:prices},function(data){
      if(data==1){
      layer.msg("操作成功！");
      if(prices==1){
        $(obj).attr("onclick","ajax_sale(this,"+id+",2)");
        $(obj).removeClass("fa-check");
        $(obj).addClass("fa-close");
      }else if(prices==2){
        $(obj).attr("onclick","ajax_sale(this,"+id+",1)");
        $(obj).removeClass("fa-close");
        $(obj).addClass("fa-check");
      }
    }else if(data==2){
      layer.msg("操作失败！");
    }
  });  
}
//排序商品品牌
function sort(obj,id){
    var vals=$(obj).val();
    $.post("brand.php",{act:'ajax_sort',brand_id:id,val:vals},function(data){
      alert(data);
        if(data==1){
            window.location.reload();
        }else{
            layer.msg("操作失败！");
        }
    });
}
//ajax删除商品品牌
function ajax_del(obj,id){
    $.post("brand.php",{act:'ajax_del',brand_id:id},function(data){
        if(data==1){
          layer.msg("该品牌下有商品存在，不可删除！");            
        }else if(data==2){
          layer.msg("操作成功！");
          $('#'+id).remove();
        }else{
          layer.msg("操作失败！");
        }
    });
}


</script>
</html><?php }} ?>